home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Blitz2 / BlitzFaq / FaqLists / Parselha.txt < prev    next >
Encoding:
Text File  |  1996-09-05  |  1.6 KB  |  46 lines

  1.   WBStartup
  2.   WbToScreen 0
  3.  
  4.   MaxLen pa$=160
  5.   MaxLen fi$=160
  6.   MaxLen pt$=160
  7.  
  8.   pa$="PROGDIR:"
  9.   pt$="#?.lha#?"
  10.   ti$="Select an Lha archive"
  11.  
  12.   filename$=ASLFileRequest$(ti$,pa$,fi$,pt$)  ; Open fileselector
  13.   NPrint "Packed   Original    Length    FileName$"
  14.   If OpenFile(0,filename$)
  15.     FileInput 0
  16.     While pos < Lof(0)
  17.         FileSeek 0,pos
  18.             If Instr(Edit$(7),"-lh")                    ; If fileheader= "-lh"
  19.               FileSeek 0,pos+7
  20.               s1$=Inkey$(1): s2$=Inkey$(1):s1$=s2$+s1$  ; lengths are stored as
  21.                                                         ; 2 bytes but arse about
  22.               Packed=Cvi(s1$)                           ; Get Packed Filesize
  23.               FileSeek 0,pos+11                         ;
  24.               s1$=Inkey$(1): s2$=Inkey$(1):s1$=s2$+s1$
  25.               Original=Cvi(s1$)                         ; Get Original FileSize
  26.               FileSeek 0,pos+20
  27.               Length=Cvi(Inkey$(2))                    ; Get Length of Filename
  28.               FileName$=Edit$(Length)                  ; Get Filename
  29.               pos=Loc(0)
  30.               ;
  31.               ; Gotta figure out how to find the next filename in the archive.
  32.               ; I reckon once I get the Packed size I can just jump ahead in the
  33.               ; file by the packed amount starting from the end of the last filename
  34.               ; found?? Whaddaya reckon??????????
  35.               ;
  36.               NPrint Packed,"      ",Original,"      ",Length,"     ",FileName$
  37.             EndIf
  38.             pos=pos+Packed+2
  39.     Wend
  40.     CloseFile 0
  41.     DefaultInput
  42.   EndIf
  43.  
  44.   MouseWait
  45.   End
  46.